#pragma once

#include <vector>
#include <map>
#include "Vocoder.h"
#include "Sample.h"
#include "SoundBank.h"

class Scale;
class WaveFormProvider;

/*
Implementation of Carrier, that uses WaveFormProviders to create waves that are then added together to form the carrier signal.
See Vocoder.h for documentation on Carrier.
*/
class CarrierImpl :
	public Carrier
{
public:
	CarrierImpl(void);
	~CarrierImpl(void);

	//Carrier methods
	void SetFrequencyProvider(FrequencyProvider* frequencyProvider);
	void SetVocoderListener(VocoderListener* vocoderListener);
	short* CreateCarrierSample(Settings* settings, short* modulatorSample, unsigned int length, std::vector<SampleMarker>* markers);

	SoundBank* soundBank;	
	Scale* scale;

	//External sample providers. None are deleted in destructor.
	std::vector<SampleDataProvider*> externalProviders;

private:
	void Initialize();
	void AddWaveFormProvider(WaveForm waveForm);
	void UpdateWaveFormProviders(Settings* settings, unsigned int frequency, int frequencyVariation);

	//Standard waveform sample providers. All are deleted in destructor.
	//Intensity of each is determined in settings object
	std::map<WaveForm, WaveFormProvider*> waveFormProviders;

	Sample mySample;
	FrequencyProvider* frequencyProvider;
	VocoderListener* vocoderListener;

};
